package com.xtayfjpk.zookeeper.test.master_workers.callback;

import org.apache.zookeeper.AsyncCallback.StatCallback;
import org.apache.zookeeper.KeeperException.Code;
import org.apache.zookeeper.data.Stat;

public class BaseStatCallback implements StatCallback {

	@Override
	public final void processResult(int rc, String path, Object ctx, Stat stat) {
		switch (Code.get(rc)) { 
        case CONNECTIONLOSS:
        	connectionLossCaseAction(rc, path, ctx, stat);            
            break;
        case OK:
        	okCaseAction(rc, path, ctx, stat);
            break;
        case NONODE:
            noNodeCaseAction(rc, path, ctx, stat);
            break;
        default:     
            defaultCaseAction(rc, path, ctx, stat);
            break;
        }

	}

	protected void connectionLossCaseAction(int rc, String path, Object ctx, Stat stat) {
	}
	protected void okCaseAction(int rc, String path, Object ctx, Stat stat) {
	}
	protected void noNodeCaseAction(int rc, String path, Object ctx, Stat stat) {
	}
	protected void defaultCaseAction(int rc, String path, Object ctx, Stat stat) {
	}
	
	
}
